//
//  TOCircleListViewController.m
//  X-Tribe
//
//  Created by Miss.Ou on 16/4/3.
//  Copyright © 2016年 Miss.Ou. All rights reserved.
//


#import "TOCircleListViewController.h"
#import "TOCircleTableViewCell.h"
#import "TOCircleHead.h"
#import "RecommandViewController.h"

@interface TOCircleListViewController ()<UITableViewDataSource,UITableViewDelegate,CircleHeadDelegate>

@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)TOCircleHead *header;

@end

@implementation TOCircleListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self createTableView];
}



#pragma mark - 创建TableView
-(void)createTableView
{
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-49-64) style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    //自定义cell Xib注册
    [self.tableView registerNib:[UINib nibWithNibName:@"TOCircleTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"circleTableViewCell"];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self createHeader];
    
}

-(void)createHeader
{
    self.header = [[TOCircleHead alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
    self.header.circleHeadDelegate = self;
    self.tableView.tableHeaderView = self.header;
    
    
}

#pragma mark - TableView代理方法

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    TOCircleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"circleTableViewCell"];
    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 180;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    RecommandViewController *activityVC = [[RecommandViewController alloc] init];
    [self.navigationController pushViewController:activityVC animated:YES];
}

-(void)JumpToActivityView{
    RecommandViewController *recomVC = [[RecommandViewController alloc] init];
    [self.navigationController pushViewController:recomVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
